package com.bw.exam.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bw.exam.mapper.SpecificationOptionMapper;
import com.bw.exam.pojo.Specification;
import com.bw.exam.pojo.SpecificationOption;
import com.bw.exam.service.SpecificationService;
import com.bw.exam.mapper.SpecificationMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @author liuzhiping
* @description 针对表【tb_specification】的数据库操作Service实现
* @createDate 2024-07-18 15:04:03
*/
@Service
public class SpecificationServiceImpl extends ServiceImpl<SpecificationMapper, Specification>
    implements SpecificationService{


    @Resource
    private SpecificationMapper specificationMapper;

    @Resource
    private SpecificationOptionMapper specificationOptionMapper;

    @Override
    public Object insert(Specification specification) {

        specificationMapper.insert(specification);

        for(SpecificationOption specificationOption :specification.getSpecificationOptionList()){
            specificationOption.setId(specification.getId());
            specificationOptionMapper.insert(specificationOption);
        }

        return null;
    }
}




